/*--Advertising slide--*/
var t = n = 0, count = $("#slidelist a").size();
$(function(){
	$("#date").val(TomorrowToStr());
	$("#enddate").val(nextDayToStr(TomorrowToStr()));
	$("#slidelist a:not(:first-child)").hide();
	$("#slideinfo").html($("#slidelist a:first-child").find("img").attr('alt'));
	$("#slidetext li:first-child").css({"background":"#ffffff"});
	$("#slidetext li:first-child").css({"border":"#ff7a02 solid 1px"});
	$("#slideinfo").click(function(){window.open($("#slidelist a:first-child").attr('href'), "_blank")});
	$("#slidetext li").click(function() {
		var i = $(this).text() - 1;
		n = i;
		if (i >= count) return;
		$("#slideinfo").html($("#slidelist a").eq(i).find("img").attr('alt'));
		$("#slideinfo").unbind().click(function(){window.open($("#slidelist a").eq(i).attr('href'), "_blank")})
		$("#slidelist a").filter(":visible").fadeOut(500).parent().children().eq(i).fadeIn(1000);
		$(this).css({"background":"#ffffff"}).siblings().css({"background":"#0070a2"});
		$(this).css({"border":"#ff7a02 solid 1px"}).siblings().css({"border":"#418dc0 solid 1px"});
	});
	t = setInterval("showAuto()", 7000);
	$("#slide").hover(function(){clearInterval(t)}, function(){t = setInterval("showAuto()", 7000);});
	$("#prev").click(function() {
	--n;
	if (n<0) {
	n=count-1;
	}
	$("#slidetext li").eq(n).trigger('click');
	});
	$("#next").click(function() {
	++n;
	if (n >count-1) {
	n=0;
	}
	$("#slidetext li").eq(n).trigger('click');
	});

})

function showAuto()
{
	n = n >= (count - 1) ? 0 : ++n;
	$("#slidetext li").eq(n).trigger('click');
}

$(document).ready(function(){
	$(".stnav li:first").addClass("current");
	$(".stnav li").click(function(){
		$(".stnav li").removeClass("current");
		$(this).addClass("current");
		$(".arealist").hide();
		$("."+ $(this).attr("id")).show();
	});
	var obj =$(".tjlist ul");
	var code = $(".tjtit li:first").attr("val")
	returnHotels(code);
function returnHotels(code){
	obj.css("text-align","center").html("<img src=\"images/hotel_load.gif\" />");
	var result = "";
	var cache =obj.data(code); 
	if(cache==null){
	$.ajax({
		async:true,
		type:"POST",
		url:"hotel/loadHotels.do?op=hotelsIndex",
		data:"code="+code,
		success:function(data){
		var hotelData = data.split("^")[0];
		var queryData = data.split("^")[1];
		hotelData = eval("(" + hotelData + ")");
		queryData = eval("(" + queryData + ")");
		for(var i=0;i<hotelData.length;i++){
			var hotel_name=hotelData[i].item;
			if(hotel_name.length>10){hotel_name=hotel_name.substring(0,10)+"...";}
			result +="<LI><A title=\""+hotelData[i].item+"\" href=\"/hotel/loadHotels.do?op=getHotelInfo"+"&date2="+queryData.checkInDate+"&enddate2="+queryData.checkOutDate+"&cityCode="+code+"&itemCode="+hotelData[i].code+"&for=1\">"+hotel_name+"</A>"+hotelData[i].rooms[0].rates[0].salePrice+"</LI>"
		}
		cache=obj.data(code,result);
		obj.html(result);
		}
	});
	}else{obj.html(cache);}
//	obj.removeData(code);
}
$(".tjtit li:first").addClass("current");
	$(".tjtit li").click(function(){
		$(".tjtit li").removeClass("current");
		$(this).addClass("current");
		returnHotels($(this).attr("val"));
	});
	$(".taghot div:first").addClass("current");
	$(".taghot div").click(function(){
		$(".taghot div").removeClass("current");
		$(this).addClass("current");
		$(".checklist").hide();
		$("."+ $(this).attr("id")).show();
	});
});
$(".colseche").click(function(){
		$(".filtermore").hide();
	});
$(".chemore").click(function(){
		$(".filtermore").show();
	});
